<template>
  <div class="score-card-container" @click.self="$emit('close')">
    <div class="card-view">
      <div>
        <div>我的分数：{{ totalScore }}</div>
      </div>
      <div class="award-view">
        <div>我的奖状：</div>
        <div v-if="totalScore < 100">暂时还没达到100分，请再接再厉哦！</div>
        <image style="margin-left:30px; width: 260px;" v-else src="https://oss.hkrin.com/other_img/award20230529.jpg" mode="widthFix"></image>

      </div>
    </div>
  </div>
</template>

<script>
import { request, API} from '../../common/request';
export default {
  name: "score-card",
  props: {

  },
  data() {
    return {
      totalScore: 0,
      isReceived: false,
    }
  },
  computed: {},
  methods: {
    clickCardView() {
      console.log('card view tap');
    },

    fetchUserScore() {
      request({
        path:API.SCENE_USER_SCORE,
      }).then(res => {
        if (res.isSuccess) {
          this.totalScore = res.data.total_score;
          this.isReceived = res.data.is_received == 0 ? false : true;
        }
      });
    },

  },
  watch: {},

  // 组件周期函数--监听组件挂载完毕
  mounted() {
    this.fetchUserScore();
  },
  // 组件周期函数--监听组件数据更新之前
  beforeUpdate() {},
  // 组件周期函数--监听组件数据更新之后
  updated() {},
  // 组件周期函数--监听组件激活(显示)
  activated() {},
  // 组件周期函数--监听组件停用(隐藏)
  deactivated() {},
  // 组件周期函数--监听组件销毁之前
  beforeDestroy() {}
 
}
</script>

<style lang="scss" scoped>

.score-card-container {
  position: fixed;
  width: 100%;
  height: 100%;
  z-index: 9999;
  top: 0;
  left: 0;
  background-color: rgba(6, 6, 6, 0.427);
  display: flex;
}

.card-view {
  color: white;
  margin: auto;
  width: 60%;
  height: 60%;
  background-color: #174276;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  padding: 20px;
}

.award-view {
  margin-top: 20px;
  display: flex;
  flex-direction: row;
  align-items: flex-start;
}

// .award-view-received {
//   align-items: flex-start;
// }


</style>